<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <title>招标目录管理</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
<!-- <div id="divv" style="width:990px;height:16px;background-color:white;position:absolute;top:437px;left:15px;">
</div> -->
<div class="box box-primary" id="more" style="width:110px;height:22px;background-color:#222c32;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#222c32;">
            <div class="box-body home-message" id="moreOp">
            </div>
        </div>
    <section class="content-header">
        <h1>招标目录管理</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active">药品招标管理</li>
            <li class="active">采购项目管理</li>
            <li class="active">招标目录管理</li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                    <div class="form-group form-group-xs">
                	    <label for="txtDrugName">项目名称：</label>
					    <select class="form-control" style="width:220px;" id="projId" name="projId"></select>
                	</div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">项目状态：</label>
                        <select class="form-control"  id="status" name="status">
                        	<option value="">请选择</option>
                        	<option value="1">启用</option>
                        	<option value="0">停用</option>
                        </select>
                    </div>
                    <button type="button" onclick="gridSerch()" class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>

        <table class="jqgrid" id="gridlist"></table>
        <div class=" box box-warning bottongroup"></div>
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/bidProject/getDataList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                height: 270,
                colNames: ['操作','projId', '项目名称','采购开始日期','采购结束日期','状态','品规数' ],
                colModel: [
                    { name: 'operate', width:30, align: 'center' ,sortable: false,
                      	formatter: function (val, opts, rowdata) {
                      		var str ="";
                      		str += "<a href='${ctx}/bidProject/toDrugqualityspecList.html?projId="+rowdata.projId+"&name="+rowdata.name+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -120px -20px' class='opIcon' title='按品规添加药品'></a>";
    						str += "<a href='${ctx}/bidProject/toImportDrugByCatalog.html?projId="+rowdata.projId+"&name="+rowdata.name+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px -20px' class='opIcon' title='按目录添加药品'></a>";
    						
                      		//str += "<a href='${ctx}/bidProject/toDrugqualityspecList.html?projId="+rowdata.projId+"&name="+rowdata.name+"'style='height:24px;width:90px;margin:0 ;padding:0 ;float:left;line-height:24px'>按品规添加药品</a>";
                      		//str+="<div id='"+rowdata.projId+"d' onmouseover=\"over('"+rowdata.projId+"','"+rowdata.projId+"','"+rowdata.name+"');\"  style='height:24px;width:50px;margin:0 ;padding:0 ;float:left;line-height:24px'><a>更多...</a></div>";
                      		return str;
                      	}
  					},
                    { name: 'projId', key:true,hidden:true,width: 40, align: 'center' ,sortable: false},
                    { name: 'name', width: 100, align: 'left' ,sortable: false},
                    { name: 'starttime', width: 60, align: 'center' ,sortable: false},
                    { name: 'endtime', width: 60, align: 'center' ,sortable: false},
                    { name: 'status', width: 20, align: 'center' ,sortable: false,
						formatter : function(val, opts,rowdata) {
							if (val == 1) {
								return "启用";
							} else if (val == 0) {
								return "停用";
							}
					}},
					{ name: 'drugCount', width: 20, align: 'center' ,sortable: false,formatter: function (val, opts, rowdata) {return "<a href=\"toHaveAddDrugQualityList.html?projId="+rowdata.projId+ "&name="+rowdata.name+"\">"+val+"</a>";}}
                ],
                rowNum: 0,
                rownumbers: true,
                viewrecords: true,
                caption: "采购项目列表",
                jsonReader: {
                    repeatitems: false  
                },
                loadComplete: function (data) {
                    formatSelect("#projId",data.rows);
                }
            });
            $("#gridlist").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        //查询
        function gridSerch() {
        	var projId = $("#projId").val();
        	var status = $("#status").val();
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{
    	        		"projId":projId,
    	        		"status":status
    	        		}
    	    }).trigger("reloadGrid"); //重新载入  
    	}
       
      //鼠标移动事件
        function over(id,projId,name){//鼠标移入
    	  	 
        	$("#moreOp").children().remove();
        	var coord=$("#"+id+"d").offset();
        	$("#more").css("top",coord.top-1);
        	$("#more").css("left",coord.left-$("#more").width());
        	$("#more").show();  
        	$("#moreOp").append("<a id='"+id+"w'  href='${ctx}/bidProject/toImportDrugByCatalog.html?projId="+projId+"&name="+name+"' style='color:#fff;float:left;display:block'>按目录添加药品</a>");
        	
        	
        }
        //鼠标移出，隐藏
    	var flag = false;
	    var mouseX=0;
	    var mouseY=0;
        $(document).mousemove(function(e){
			  mouseX=e.pageX;
			  mouseY=e.pageY;
			  var coord=$("#more").offset();
	   		  if((mouseX<coord.left||mouseX>(coord.left+$("#more").width())||mouseY<coord.top||
	   				  mouseY>(coord.top+$("#more").height()))&&(mouseX<(coord.left+$("#more").width())||
	   						  mouseX>(coord.left+$("#more").width()+50)||mouseY<(coord.top+1)||mouseY>(coord.top+24+1))){
	   		  	  $("#more").hide();
	   		  } 
		});
        
    </script>
</body>
</html>